<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('选择公司')"/>
    <th:block th:include="include :: select2-css"/>
    <th:block th:include="include :: bootstrap-select-css"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-Comp-add">
        <input type="hidden" id="type" name="type" th:value="${type}">
        <div class="form-group">
            <label class="col-sm-3 control-label ">公司：</label>
            <div class="col-sm-8">
                <select id="ids" name="ids" class="form-control select2-multiple" multiple>
                    <option></option>
                    <option th:each="companysList:${companysList}" th:value="${companysList.compID }"
                            th:text="${companysList.title }"></option>
                </select>
            </div>
        </div>
    </form>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: bootstrap-select-js"/>
<script type="text/javascript">
    var prefix = ctx + "company/admin";

    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-Comp-add").serializeArray();
            var ids = $("#compID").val();
            var type = $("#type").val();
            data.push({"id": "ids", "value": ids});
            data.push({"id": "type", "value": type});
            $.operate.save(prefix + "/addComp", data);
        }
    }
</script>
</body>
</html>